//
// Created by hsj on 2022/1/18.
//

#include <iostream>
#include "t_class_extend.h"

namespace hsj_class_extend{
    //测试类的继承
    void test_class_extend(){
//        TableTennisPlayer plaer1 = TableTennisPlayer("He","Shengjin",true);
//        TableTennisPlayer plaer2("He","ShengXian", false);
//
//        plaer1.Name();
//        if (plaer1.HasTable()){
//            cout<<": has table."<<endl;
//        }
//        else{
//            cout<<": not has table."<<endl;
//        }
//
//        plaer2.Name();
//        if (plaer2.HasTable()){
//            cout<<": has table."<<endl;
//        }
//        else{
//            cout<<": not has table."<<endl;
//        }

        /**
         *  TableTennisPlayer init...
            RatedPlayer init...
            ----------------------------
            TableTennisPlayer init...
            RatedPlayer init...
         */
        RatedPlayer rp1(18,"He","Shengjin",true);
        cout<<"----------------------------"<<endl;
        RatedPlayer rp2 = RatedPlayer(18,"He","Shengxian",true);
//        rp2.Name();


        //c++多态
        //JAVA语言一样的使用方式
        cout<<"------------pointer&&ref----------------"<<endl;
        TableTennisPlayer *ttpp = &rp1;
        TableTennisPlayer &ttpr = rp2;
        ttpp->Name();//(*ttpp).Name();
        (*ttpp).Name();//ttpp->Name();
        ttpr.Name();
    }
}